package com.edu.study.base.lmsOrderItem.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.edu.study.base.lmsOrderItem.domain.LmsOrderItem;
import com.edu.study.base.lmsOrderItem.service.ILmsOrderItemService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * LmsOrderItemController
 * 
 * @author zw
 * @date 2021-08-11
 */
@RestController
@RequestMapping("/LmsOrderItem/LmsOrderItem")
public class LmsOrderItemController extends BaseController
{
    @Autowired
    private ILmsOrderItemService lmsOrderItemService;

    /**
     * 查询LmsOrderItem列表
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderItem:LmsOrderItem:list')")
    @GetMapping("/list")
    public TableDataInfo list(LmsOrderItem lmsOrderItem)
    {
        startPage();
        List<LmsOrderItem> list = lmsOrderItemService.selectLmsOrderItemList(lmsOrderItem);
        return getDataTable(list);
    }

    /**
     * 导出LmsOrderItem列表
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderItem:LmsOrderItem:export')")
    @Log(title = "LmsOrderItem", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LmsOrderItem lmsOrderItem)
    {
        List<LmsOrderItem> list = lmsOrderItemService.selectLmsOrderItemList(lmsOrderItem);
        ExcelUtil<LmsOrderItem> util = new ExcelUtil<LmsOrderItem>(LmsOrderItem.class);
        return util.exportExcel(list, "LmsOrderItem");
    }

    /**
     * 获取LmsOrderItem详细信息
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderItem:LmsOrderItem:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(lmsOrderItemService.selectLmsOrderItemById(id));
    }

    /**
     * 新增LmsOrderItem
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderItem:LmsOrderItem:add')")
    @Log(title = "LmsOrderItem", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LmsOrderItem lmsOrderItem)
    {
        return toAjax(lmsOrderItemService.insertLmsOrderItem(lmsOrderItem));
    }

    /**
     * 修改LmsOrderItem
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderItem:LmsOrderItem:edit')")
    @Log(title = "LmsOrderItem", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LmsOrderItem lmsOrderItem)
    {
        return toAjax(lmsOrderItemService.updateLmsOrderItem(lmsOrderItem));
    }

    /**
     * 删除LmsOrderItem
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderItem:LmsOrderItem:remove')")
    @Log(title = "LmsOrderItem", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(lmsOrderItemService.deleteLmsOrderItemByIds(ids));
    }
}
